package com.health.healthproject.config;

import cn.dev33.satoken.stp.StpInterface;
import com.health.healthproject.entity.User;
import com.health.healthproject.mapper.UserMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName StpInterfaceImpl
 * @Author 任宝坤
 * @Date 2025/4/9 16:39
 * @Version v1.0
 **/
@Component
public class StpInterfaceImpl implements StpInterface {

    @Resource
    private UserMapper userMapper;
    @Override
    public List<String> getRoleList(Object o, String s) {
        User user = userMapper.selectById(Long.parseLong(o.toString()));
        List<String> list = new ArrayList<>();
        list.add(user.getUserAuth());
        return list;
    }

    @Override
    public List<String> getPermissionList(Object o, String s) {
        return Collections.emptyList();
    }
}
